package controller

import (
	"context"
	"xr-game-server/core/httpserver"
	"xr-game-server/dto/guilddto"
	"xr-game-server/module/guild"
)

const (
	GuildUrl = "guild"
)

type Guild struct {
}

func initGuild() {
	httpserver.RegAPI(GuildUrl, new(Guild))
}

// Create 创建公会
func (g *Guild) Create(ctx context.Context, req *guilddto.GuildCreateReq) (res string, err error) {
	return guild.CreateGuild(ctx, req)
}

// Join 申请加入公会
func (g *Guild) Join(ctx context.Context, req *guilddto.GuildJoinReq) (bool, error) {
	return guild.JoinGuild(ctx, req)
}

// Approve 审批公会申请
func (g *Guild) Approve(ctx context.Context, req *guilddto.GuildApproveReq) (bool, error) {
	return guild.ApproveApplication(ctx, req)
}

// Kick 踢出公会成员
func (g *Guild) Kick(ctx context.Context, req *guilddto.GuildKickReq) (bool, error) {
	return guild.KickMember(ctx, req)
}

// Transfer 转让公会会长
func (g *Guild) Transfer(ctx context.Context, req *guilddto.GuildTransferReq) (bool, error) {
	return guild.TransferGuild(ctx, req)
}
func (g *Guild) QuitGuild(ctx context.Context, req *guilddto.GuildQuitReq) (bool, error) {
	return guild.QuitGuild(ctx, req)
}

// Info 获取公会信息
func (g *Guild) GetGuildInfo(ctx context.Context, req *guilddto.GuildInfoReq) (res *guilddto.GuildInfoRes, err error) {
	return guild.GetGuildInfo(ctx, req)
}

func (g *Guild) GetGuildMemberInfo(ctx context.Context, req *guilddto.GuildMemberInfoReq) (*guilddto.GuildMemberInfoRes, error) {
	return guild.GetGuildMemberInfo(ctx, req)
}

func (g *Guild) GetGuildApplications(ctx context.Context, req *guilddto.GuildApplicationsReq) (*guilddto.GuildApplicationsRes, error) {
	return guild.GetGuildApplications(ctx, req)
}

func (g *Guild) PushRefreshGuildMemberReq(ctx context.Context, req *guilddto.PushRefreshGuildMemberReq) (res *guilddto.PushRefreshGuildMemberRes, err error) {
	return nil, err
}
func (g *Guild) PushApproveListRefresh(ctx context.Context, req *guilddto.PushApproveListRefreshReq) (res *guilddto.PushApproveListRefreshRes, err error) {
	return nil, err
}

func (g *Guild) BlacklistApplicant(ctx context.Context, req *guilddto.GuildBlacklistReq) (bool, error) {
	return guild.BlacklistApplicant(ctx, req)
}
func (g *Guild) SetGuildAutoApprove(ctx context.Context, req *guilddto.SetGuildAutoApproveReq) (bool, error) {
	return guild.SetGuildAutoApprove(ctx, req)
}
